package com.csdj.t309.controller;

import com.csdj.t309.common.WebResult;
import com.csdj.t309.entity.CityArea;
import com.csdj.t309.entity.CityAreaExample;
import com.csdj.t309.service.ICityAreaService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class CityAreaController {
    @Resource
    private ICityAreaService cityAreaService;

    @ResponseBody
    @GetMapping("selCityArea")
    public WebResult selCity() {
        CityAreaExample cityAreaExample = new CityAreaExample();

        List<CityArea> list = cityAreaService.selectByExample(cityAreaExample);

        WebResult webResult = new WebResult();
        if (list != null && list.size() > 0) {
            webResult.putData("City", list);
            return webResult;
        }
        return null;
    }
}
